﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Commerce.Base.Web.SiteMap
{
    public class SiteMapNode
    {
        private string key;
        private string name;
        private SiteMapNode parentNode;
        private List<SiteMapNode> childNodes;

        public string Key
        {
            get { return key; }
            set { key = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string Url
        {
            get
            {
                return null;
            }
        }

        public SiteMapNode ParentNode
        {
            get { return parentNode; }
        }

        public List<SiteMapNode> ChildNodes
        {
            get { return childNodes; }
        }

        public bool HasChildNodes
        {
            get { return (childNodes != null && childNodes.Count > 0); }
        }

        public SiteMapNode(string key, string name)
        {
            this.key = key;
            this.name = name;
            this.parentNode = null;
            this.childNodes = new List<SiteMapNode>();
        }

        public void AddChildNode(SiteMapNode node)
        {
            this.childNodes.Add(node);
            node.parentNode = this;
        }
    }
}
